<?php
class Merchant_Service_User
{
	public function __construct(){
		
	}

	public static function getByUserId($userId){		
		$obj = new Merchant_Model_User();
		$row=$obj->getByUserId($userId);
		if(!empty($row)){
			$row=$row->toArray();
		}
		return $row;
	}
	
	public static function getByLoginId($Id){		
		$obj = new Merchant_Model_User();
		$row=$obj->getByLoginId($Id);
		if(!empty($row)){
			$row=$row->toArray();
		}
		return $row;
	}
	
	public static function comparePassword($pwd1,$pwd2){		
		if($pwd1==$pwd2){
			return true;
		}else {
			return false;
		}
	}
	
	public static function getRealIp(){
       if(getenv('HTTP_CLIENT_IP')){
         $ip=getenv('HTTP_CLIENT_IP');
       }
       elseif(getenv('HTTP_X_FORWARDED_FOR')){
         $ip=getenv('HTTP_X_FORWARDED_FOR');
      }
      elseif(getenv('REMOTE_ADDR')){
         $ip=getenv('REMOTE_ADDR');
      }
      else{
         $ip=$HTTP_SERVER_VARS['REMOTE_ADDR'];
      }
         return $ip;
   }

}